package com.xiaoxiong.database;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.database.Cursor;

/**
 * 预交费用表操作类
 * @author pure
 */
public class OperateFormPrepaidExpenses {
	
	private DatabaseOperate dbOperate;
	
	public OperateFormPrepaidExpenses(Context context){
		dbOperate=new DatabaseOperate(context,"tmis");
	}

	/**
	 * 预交费用表插入
	 * @param spend_item 花费项
	 * @param money 费用
	 * @author pure
	 */
	public void insertPrepaidExpenses(String spend_item,String money){
		List<String> column=new ArrayList<String>();
		column.add("spend_item");
		column.add("money");
		List<Object> values=new ArrayList<Object>();
		values.add(spend_item);
		values.add(money);
		dbOperate.insert("prepaid_expenses", column, values);
	}
	
	/**
	 * 预交费用表查询
	 * @return Cursor 结果集
	 * @author pure
	 */
	public Cursor queryPrepaidExpenses(){
		return dbOperate.query("prepaid_expenses");
	}
	
	/**
	 * 预交费用表删除所有
	 * @author pure
	 */
	public void deleteAllPrepaidExpenses(){
		dbOperate.deleteAll("prepaid_expenses");
	}
	
	/**
	 * 预交费用表重新导入
	 * @param spend_item 花费项
	 * @param money 费用
	 * @author pure
	 */
	public void reImportPrepaidExpenses(String title,String info){
		deleteAllPrepaidExpenses();
		insertPrepaidExpenses(title, info);
	}
	
}
